<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DWR 测试</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js-lib/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/Demo.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/pusher.js"></script>
<script type="text/javascript">
	function invokeJava() {
		/* Demo.sayHello("中国", function(data){
			alert(data);
		}); */
		Demo.sayHello("中国", {
			callback:function(data){
				alert(data);
			}
		});
	}
	function getPush() {
		pusher.push();
	}
</script>
<script type="text/javascript" >
   //这个方法用来启动该页面的ReverseAjax功能
   dwr.engine.setActiveReverseAjax( true);
   //设置在页面关闭时，通知服务端销毁会话
   dwr.engine.setNotifyServerOnPageUnload( true);
   //这个函数是提供给后台推送的时候 调用的
   function show(content, point){ 
       $("#content").text(content);
       console.info(point);
       $("#content2").text("x=" + point.x + ",y=" + point.y);
   }
</script>
</head>
<body>

<div><button onclick="invokeJava()">调用Java</button><button onclick="getPush()">获取推送</button></div>
<div id="content"></div>
<div id="content2"></div>
</body>
</html>